package com.clusterswisdom.horn.api.db.cursor;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.alibaba.fastjson.JSONObject;

public class TaskItemCursor extends AbstractCursor {

	public TaskItemCursor(Connection conn, ResultSet resultSet) {
		super(conn, resultSet);
	}
	
	public JSONObject getNextObj() throws SQLException {
		if (resultSet.next()) {
			Long itemId = resultSet.getLong("ITEM_ID");
			String content = resultSet.getString("ITEM_CONTENT");
			JSONObject obj = JSONObject.parseObject(content);
			obj.put("ITEM_ID", itemId);
			
			return obj;
			
		} else {
			return null;
			
		}
	}

}
